public class demo26 {
    class Solution {
    public int numberOfChild(int n, int k) {
        int rt = k/(n-1);
        int mod = k%(n-1);
        if(rt%2 == 0)
            return mod;
        else
            return (n-1)-mod;
    }
}
}
